import {request} from "@/utils/request";
import type BaseResponse from "@/api/types/BaseResponse";
import type ScheduleResponse from "@/api/types/schedule/ScheduleResponse";

export async function getScheduleByAttendanceGroupIdAndDate(attendanceGroupId: number, date: string) {
    return await request<BaseResponse<ScheduleResponse[]>>({
        url: "/kaoqin/schedule",
        method: "GET",
        data: {
            groupid: attendanceGroupId,
            day: date
        },
        isAuthenticated: true
    })
}

// 通过门店ID和日期获取排班
export async function getScheduleByShopIdAndDate(shopId: number, date: string) {
    return await request<BaseResponse<ScheduleResponse[]>>({
        url: "/kaoqin/schedule",
        method: "GET",
        data: {
            shop_id: shopId,
            day: date
        },
        isAuthenticated: true
    })
}

// 通过月获取当前用户的排班
export async function getCurrentUsersSchedules(month: string) {
    return await request<BaseResponse<ScheduleResponse>>({
        url: "/schedule/user",
        method: "GET",
        data: {month},
        isAuthenticated: true
    })
}
